package com.sunducation.wts.livedata2

import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class ShareDataViewModel : ViewModel() {
    private var progress: MutableLiveData<Int>? = null
    override fun onCleared() {
        super.onCleared()
        Log.i("ViewModel", "onCleared----${progress}")
        progress = null;
    }
    public fun getProgress(): LiveData<Int>{
        progress = progress?:MutableLiveData<Int>();
        Log.i("ViewModel", "getProgress----${progress}")
        return progress!!;
    }

    public fun setProgress(p: Int){
        Log.i("ViewModel", "setProgress----${progress} -- ${p}")
        progress?.value = p
    }
}